/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import java.awt.Component;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;


public class TimeRenderer extends DefaultTableCellRenderer {
    private static final long serialVersionUID = 1L;
    @Override
    public Component getTableCellRendererComponent(
            JTable table, Object value, boolean isSelected,
            boolean hasFocus, int row, int column) {
        long minutes = (long)value/60;
        long seconds = (long)value - minutes*60;
        //pat3group - spyros: τυπώνω σε μορφή λεπτά:δεύτερα
        //το σύντομο if(seconds<10) προσθέτει μηδενικό πριν από 
        //μονοψήφια στα δευτερόλεπτα
        value = minutes+":"+((seconds<10)?"0"+seconds:seconds);
        return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    }
}